﻿using Sunny.UI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace PanhuaWin.通用
{
    public partial class Form供应商档案 : UIForm
    {

      public  string 供应商编号;
        
        public Form供应商档案()
        {
            InitializeComponent();
        }

        private void uiButton查询_Click(object sender, EventArgs e)
        {
            List供应商();

        }

        private void List供应商()
        {
            string sql;
            sql = @"select  t_rm_are as 地区, t_rm_are_code, t_rm_province as 省市, t_rm_province_code, 
                t_rm_city as 城市, t_rm_city_code, t_rm_name as 供应商名称, t_rm_code as 供应商编号, 
                t_rm_type as 供应商类型, t_rm_fl, t_rm_fl_code, t_rm_company_nature_code, 
                t_rm_company_nature, t_rm_business_start_date, t_rm_business_start_end, t_rm_work_statue, 
                t_rm_work_statue_code, t_rm_cor_rep, t_rm_registered_capital, t_rm_taxpayer_qualification, 
                t_rm_taxpayer_qualification_code, t_rm_office_add, t_rm_business, t_rm_registered_add, 
                t_rm_uni_code, t_rm_bank_deposit, t_rm_bank_deposit_code, t_rm_bank_name, 
                t_rm_bank_account, t_rm_website, t_rm_office_tel, t_rm_zip_code, t_rm_fax, t_rm_remark, exp2, 
                exp3, t_create_date, t_update_date
FROM      T_VIEW_RM where 1=1 ";
            string tj = this.uiTextBox条件.Text.Trim().Replace("--", "");
            if (tj!="")
            {

                sql += " and t_rm_name like '%" + tj + "%' or t_rm_code like  '%" + tj + "%' ";
            }
            DataTable tb = pub.GetDataTable(pub.ConnectionString,sql);
            this.uiDataGridView1.AutoGenerateColumns = false;
            this.uiDataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
            this.uiDataGridView1.DataSource = tb;
            this.uiDataGridView1.Refresh();
                    }

        private void uiDataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            
             供应商编号 = this.uiDataGridView1.Rows[e.RowIndex].Cells["C供应商编号"].Value.ToString();
            this.DialogResult= DialogResult.OK;
            this.Close();

        }
    }
}
